Add PR preview builds with Cloudflare preview URLs - #21
Open
stu-greenshoots wants to merge 1 commit into
Open
Conversation
Workers Builds deploys main to production but reports nothing back to GitHub, so PRs had no build check and no preview. This workflow builds every PR, uploads the result as a Worker version (production untouched) and posts a sticky comment with the preview URL. Without the Cloudflare secrets the build still runs as a check and the upload is skipped. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HVg4d3Fg3MLk6MEyjeYowp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
.github/workflows/pr-preview.yml: every PR againstmainnow getsastro buildcheck (the repo previously had no CI on PRs at all), andwrangler versions upload(production traffic is untouched), and a sticky PR comment links the*.workers.devpreview URL.Why
Workers Builds deploys
mainto production but reports nothing back to GitHub — no checks, no statuses, no comments (verified on #18 and #20) — so there was no way to preview a PR from GitHub. PR #16 additionally recommends disabling Workers Builds for non-production branches; with this workflow, previews come from Actions instead, so that recommendation can be actioned without losing anything.Setup required before this works
Two repository secrets (Settings → Secrets and variables → Actions):
CLOUDFLARE_API_TOKEN— token with Workers Scripts: Edit on the OpenDialog accountCLOUDFLARE_ACCOUNT_ID— the account idUntil they exist (and on fork/Dependabot PRs, which cannot read secrets), the workflow still runs the build as a check and skips the upload with a note in the job summary — no red X.
🤖 Generated with Claude Code
https://claude.ai/code/session_01HVg4d3Fg3MLk6MEyjeYowp